<?php

namespace App\Admin\Actions\Row;


use App\Admin\Forms\AllotForm;
use App\Models\MaintainOrder;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;

class Allot extends RowAction
{
    /**
     * @return string
     */
	protected $title = '分配维修工';

    public function render()
    {
        // 实例化表单类并传递自定义参数
        $maintain = MaintainOrder::query()->where('id',$this->getKey())->first();
        $params['id']               = $this->getKey();
        $params['maintain_user']    = $maintain->maintain_user;
        $form = AllotForm::make($params);
        return Modal::make()
            ->lg()
            ->title($this->title)
            ->body($form)
            ->button($this->title);
    }


}
